﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace ZTool.Converters
{
    [ValueConversion(typeof(string), typeof(TextWrapping))]
    public class WrapConverter : ConverterMarkupExtension<WrapConverter>
    {
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string v = value as string;
            if (!string.IsNullOrEmpty(v))
            {
                return v.ToLower() == "wrap" ? TextWrapping.Wrap : TextWrapping.NoWrap;
            }

            return TextWrapping.NoWrap;
        }

        public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
